﻿using GTMC.Enum;
using GTMC.Interface.Communi;
using GTMC.Model;
using SPSAndong.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SPSAndong.Model
{
    /// <summary>
    /// 丰田工机数据模型
    /// </summary>
    public class TriaModel
    {
        /// <summary>
        /// 丰田工机标识
        /// </summary>
        public string TriaID { get; set; }
        /// <summary>
        /// TriaIP
        /// </summary>
        public string Ip { get; set; }
        /// <summary>
        /// Tria端口
        /// </summary>
        public int Port { get; set; }
        /// <summary>
        /// 访问方式(readOnly/writeOnly/readAndWrite)
        /// </summary>
        public string AccessMode { get; set; }
        /// <summary>
        /// 丰田工机操作对象
        /// </summary>
        public IToyopuc ToyopucHandler { get; set; }
        /// <summary>
        /// 地址
        /// </summary>
        public IndirectAddress TriaAddress { get; set; }
        /// <summary>
        /// 程序编号
        /// </summary>
        public ProgramCode ProgramCode { get; set; }
        /// <summary>
        /// 地址长度
        /// </summary>
        public short AddressLength { get; set; }
        /// <summary>
        /// 数据组集合
        /// </summary>
        public List<TriaGroup> TriaGroups { get; set; }
        /// <summary>
        /// 当前模型缓存二进制数据字符串
        /// </summary>
        public string DataStr { get; set; }
        /// <summary>
        /// 当前模型缓存字节数组
        /// </summary>
        public byte[] DataByte { get; set; }
    }
    /// <summary>
    /// 丰田工机数据组
    /// </summary>
    public class TriaGroup
    {
        /// <summary>
        /// 组ID
        /// </summary>
        public string GroupId { get; set; }
        /// <summary>
        /// 组数据类型
        /// </summary>
        public TriaDataType GroupDataType { get; set; }
        /// <summary>
        /// 当前组缓存数据二进制字符串
        /// </summary>
        public string GroupStrs { get; set; }
        /// <summary>
        /// 值
        /// </summary>
        public object Value { get; set; }
        /// <summary>
        /// 组数据集合
        /// </summary>
        public List<TriaItem> Items { get; set; }
    }

    /// <summary>
    /// 丰田工机数据项
    /// </summary>
    public class TriaItem
    {
        /// <summary>
        /// 项唯一标识
        /// </summary>
        public string ItemId { get; set; }
        /// <summary>
        /// 值
        /// </summary>
        public object Value { get; set; }
    }
}
